package end.bean.shiro;

import java.io.Serializable;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.fasterxml.jackson.annotation.JsonIgnore;

import end.bean.BaseBean;

/**
 * 
 * UserDto.java 2016-7-9
 * 
 * Copyright zhaocj Inc. All rights reserved. Love Me Like Love Justin Bieber
 */
@SuppressWarnings("serial")
public class Manager extends BaseBean implements Serializable {
	private Integer id;
	private String name;
	private String salt;
	private String password;
	private String phone;
	private List<Role> roles;
	private String code;
	private Short useStatus;
	// 登陆时间
	private String loginTime;
	// 登陆IP
	private String loginIP;

	public String getLoginIP() {
		return loginIP;
	}

	public void setLoginIP(String loginIP) {
		this.loginIP = loginIP;
	}

	public String getLoginTime() {
		return loginTime;
	}

	public void setLoginTime(String loginTime) {
		this.loginTime = loginTime;
	}

	public Short getUseStatus() {
		return useStatus;
	}

	public void setUseStatus(Short useStatus) {
		this.useStatus = useStatus;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public List<Role> getRoles() {
		return roles;
	}

	public void setRoles(List<Role> roles) {
		this.roles = roles;
	}

	@JsonIgnore
	public Set<String> getRolesName() {
		List<Role> roles = getRoles();
		Set<String> set = new HashSet<String>();
		for (Role role : roles) {
			set.add(role.getName());
		}
		return set;
	}
}
